package com.shiro.common.entity;

import com.shiro.common.entity.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: dengpeng
 * Date: 2018/7/5
 * Time: 10:36
 * Description: 角色表
 */
@EqualsAndHashCode(callSuper = true)
@Entity
@Data
@Table(name = "role")
public class Role extends BaseEntity {


    /**权限*/
    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "role_permission",
                joinColumns = {@JoinColumn(name = "role_id")},
                inverseJoinColumns = {@JoinColumn(name = "permission_id")})
    private List<Permission> permissionList;

    /**y用户*/
    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "user_role",
                    joinColumns = {@JoinColumn(name = "role_id")},
                    inverseJoinColumns = {@JoinColumn(name = "user_id")})
    private List<User> userList;
}
